from django import template
from django.utils.safestring import mark_safe

register = template.Library()

@register.simple_tag()
def get_tr_data(name_key, info_dic, get_type):
  """
  处理admin/registered-info页面tr标签中的参数
  :param name_key:
  :param info_dic:
  :param get_type:
  :return: 根据get_type参数返回一些指定的参数
  """
  dic_data = info_dic.get(name_key)
  if get_type == 'email':
    return dic_data.get('email','')
  elif get_type == 'tel':
    return dic_data.get('tel','')
  elif get_type == 'wechat':
    return dic_data.get('wechat','')
  elif get_type == 'price':
    return dic_data.get('price', '')

